package com.zhiwei.most.ext

import androidx.appcompat.widget.AppCompatTextView
import com.blankj.utilcode.util.ToastUtils
import com.blankj.utilcode.util.ViewUtils
import com.zhiwei.most.R

/**
 * Create by zhiweizhu on 2022/2/28
 */


/**
 * 自定义toast 扩展函数
 */
fun showCustomize(str: String, isLong: Boolean = false){
    if(str.isNullOrEmpty()){
        return
    }
    ToastUtils.cancel()
    ToastUtils.make()
        .setDurationIsLong(isLong)
        .show(ViewUtils.layoutId2View(R.layout.layout_toast_view).apply {
            findViewById<AppCompatTextView>(R.id.toast_view_tv).apply {
                text = str
            }
        })
}

fun showShort(str: String){
    ToastUtils.showShort(str)
}

fun showLong(str: String){
    ToastUtils.showLong(str)
}

